package site.jlopen.assets.config;

import org.apache.shiro.SecurityUtils;
import org.apache.shiro.subject.Subject;

import site.jlopen.entity.vo.LoginRes;

public class ThreadAuthUser {

	public final static String USER_SESSION = "user";

	public final static String API_SESSION = "api";
	
	public static Long id() {
		LoginRes account = info();
		if(null == account) {
			return -1L;
		}
		return account.getId();
	}

	public static LoginRes info() {
		Subject subject = SecurityUtils.getSubject();
		LoginRes account = (LoginRes) subject.getPrincipal();
		return account;
	}
}
